package com.hrt.datasender.web.system;

import java.text.ParseException;

import com.hrt.datasender.web.WebMain;
import org.springframework.stereotype.Service;

import com.btcode.schedule.ScheduleManager;
import com.hrt.datasender.datacollect.DataCollectMain;
import com.hrt.datasender.datasent.DataSender;
import com.hrt.datasender.datastorage.StorageMain;

@Service
public final class StartService {

    private static volatile StartService instance;

    private StartService() {

    }

    public static StartService getInstance() {
        if (instance == null) {
            synchronized (StartService.class) {
                if (instance == null) {
                    instance = new StartService();
                }
            }
        }
        return instance;
    }

    public void reStart() throws ParseException {
        DataCollectMain dataCollect = new DataCollectMain();
        dataCollect.start();

        StorageMain storageMain = new StorageMain();
        storageMain.start();

        DataSender.start();

        ScheduleManager.getInstance().start();
    }
}
